<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../common.jsp"%>
<html>
<head>
    <title>显示用户</title>
</head>
<body>
</body>
<style>
    #show {
        margin: auto;
        background: #C2BE9E;
        font-family: 华文行楷;
        font-size: 25px;
        color: #0C0C0C;
    }
    #bb {
        width: 200px;
        height: 80px;
        margin: auto;
        line-height: 80px;
    }
    #result {
        width: 400px;
        height: 80px;
        margin: auto;
        line-height: 80px;
    }
</style>
<div id="show" style="width: 100%;height: 100%;">
    <input name="testerId" id="testerId" value="${testerId}" type="hidden">
    <div id="bb" style="text-align: center">SCL测试结果</div>
    <div id="result" style="text-align: center"></div>
    <div style="width: 100%;height: 500px;" id="shopping"></div>
    <div style="width: 100%;background-color: rgb(255,99,71)" id="explain"></div>
</div>
<table id="demo" lay-filter="test"></table>
<script>
    layui.config({
        version: 1,
        base: '${pageContext.request.contextPath}/static/echarts/echarts.js' //这个就是你放Echart.js的目录
    })
    layui.use(['table', 'form', 'jquery', 'laydate', 'echarts'], function (data) {
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery, laydate = layui.laydate, echarts = layui.echarts;
        //弹出层
        $.ajax({
            url: "${pageContext.request.contextPath}/viewTestResultScl/queryAllById.do",
            type: "POST",
            dataType: "JSON",
            data: {
                id:$("#testerId").val()
            },
            success: function (ret) {
                var a = ret.data.somatization
                var b = ret.data.compel
                var c = ret.data.interpersonal
                var d = ret.data.depressed
                var e = ret.data.anxiety
                var f = ret.data.hostile
                var g = ret.data.terror
                var h = ret.data.bigoted
                var i = ret.data.psychotic
                var j = ret.data.sleepanddiet
                var myChart = echarts.init(document.getElementById('shopping'));
                var option;
                var string = "你的结果如下";
                $("#result").html(string)
                option = {
                    color: [
                        '#c23531',
                        '#2f4554',
                        '#61a0a8',
                        '#d48265',
                        '#91c7ae',
                        '#749f83',
                        '#ca8622',
                        '#bda29a',
                        '#6e7074',
                        '#546570',
                        '#c4ccd3'
                    ],
                    title: {
                        text: 'SCL心理健康测试',
                        left: 'center'
                    },
                    tooltip: {
                        trigger: 'item'
                    },
                    legend: {
                        data: ['你的得分', '正常值'],
                        left: 'left'
                    },
                    radar: {
                        indicator: [
                            {name: '躯体化', max: 5},
                            {name: '强迫', max: 5},
                            {name: '人际敏感', max: 5},
                            {name: '抑郁', max: 5},
                            {name: '焦虑', max: 5},
                            {name: '敌对性', max: 5},
                            {name: '恐怖', max: 5},
                            {name: '偏执', max: 5},
                            {name: '精神病性', max: 5},
                            {name: '睡眠及饮食', max: 5}
                        ],
                        radius: 120,
                        axisName: {
                            color: '#fff',
                            backgroundColor: '#666',
                            borderRadius: 3,
                            padding: [3, 5]
                        }
                    },
                    series: [
                        {
                            name: 'SCL得分',
                            type: 'radar',//雷达图类型
                            data: [
                                {
                                    value: [a, b, c, d, e, f, g, h, i, j],
                                    name: '你的得分'
                                },
                                {
                                    value: [1.45, 1.99, 1.98, 1.83, 1.64, 1.77, 1.46, 1.85, 1.63, 1.45],
                                    name: '正常值'
                                }
                            ]
                        }
                    ]
                };
                option && myChart.setOption(option);
                var htmlStr = "";
                if (a > 2.43) {
                    htmlStr += "<div><h3 align='center'>躯体化：高症状表现</h3></div>"
                }
                if (a < 0.47) {
                    htmlStr += "<div><h3 align='center'>躯体化：低症状表现</h3></div>"
                }
                if (a > 1.94 && a < 2.43) {
                    htmlStr += "<div><h3 align='center'>躯体化：较高症状表现</h3></div>"
                }
                if (a < 0.96 && a > 0.47) {
                    htmlStr += "<div><h3 align='center'>躯体化：较低症状表现</h3></div>"
                }
                if ((a > 1.45 && a < 1.94) || (a < 1.45 && a > 0.96)) {
                    htmlStr += "<div><h3 align='center'>躯体化：中等水平症状表现</h3></div>"
                }
                if (b > 3.27) {
                    htmlStr += "<div><h3 align='center'>强迫：高症状表现</h3></div>"
                }
                if (b < 0.71) {
                    htmlStr += "<div><h3 align='center'>强迫：低症状表现</h3></div>"
                }
                if (b > 2.63 && b < 3.27) {
                    htmlStr += "<div><h3 align='center'>强迫：较高症状表现</h3></div>"
                }
                if (b < 1.35 && b > 0.71) {
                    htmlStr += "<div><h3 align='center'>强迫：较低症状表现</h3></div>"
                }
                if ((b > 1.99 && b < 2.63) || (b < 1.99 && b > 1.35)) {
                    htmlStr += "<div><h3 align='center'>强迫：中等水平症状表现</h3></div>"
                }
                if (c > 3.46) {
                    htmlStr += "<div><h3 align='center'>人际敏感：高症状表现</h3></div>"
                }
                if (c < 0.5) {
                    htmlStr += "<div><h3 align='center'>人际敏感：低症状表现</h3></div>"
                }
                if (c > 2.72 && c < 3.46) {
                    htmlStr += "<div><h3 align='center'>人际敏感：较高症状表现</h3></div>"
                }
                if (c < 1.24 && c > 0.5) {
                    htmlStr += "<div><h3 align='center'>人际敏感：较低症状表现</h3></div>"
                }
                if ((c > 1.98 && c < 2.72) || (c < 1.98 && c > 1.24)) {
                    htmlStr += "<div><h3 align='center'>人际敏感：中等水平症状表现</h3></div>"
                }
                if (d > 3.13) {
                    htmlStr += "<div><h3 align='center'>抑郁：高症状表现</h3></div>"
                }
                if (d < 0.53) {
                    htmlStr += "<div><h3 align='center'>抑郁：低症状表现</h3></div>"
                }
                if (d > 2.48 && d < 3.13) {
                    htmlStr += "<div><h3 align='center'>抑郁：较高症状表现</h3></div>"
                }
                if (d < 1.18 && d > 0.53) {
                    htmlStr += "<div><h3 align='center'>抑郁：较低症状表现</h3></div>"
                }
                if ((d > 1.8 && d < 2.48) || (d < 1.83 && d > 1.18)) {
                    htmlStr += "<div><h3 align='center'>抑郁：中等水平症状表现</h3></div>"
                }
                if (e > 2.82) {
                    htmlStr += "<div><h3 align='center'>焦虑：高症状表现</h3></div>"
                }
                if (e < 0.46) {
                    htmlStr += "<div><h3 align='center'>焦虑：低症状表现</h3></div>"
                }
                if (e > 2.23 && e < 2.82) {
                    htmlStr += "<div><h3 align='center'>焦虑：较高症状表现</h3></div>"
                }
                if (e < 1.05 && e > 0.46) {
                    htmlStr += "<div><h3 align='center'>焦虑：较低症状表现</h3></div>"
                }
                if ((e > 1.64 && e < 2.23) || (e < 1.64 && e > 1.05)) {
                    htmlStr += "<div><h3 align='center'>焦虑：中等水平症状表现</h3></div>"
                }
                if (f > 3.13) {
                    htmlStr += "<div><h3 align='center'>敌对：高症状表现</h3></div>"
                }
                if (f < 0.41) {
                    htmlStr += "<div><h3 align='center'>敌对：低症状表现</h3></div>"
                }
                if (f > 2.45 && f < 3.13) {
                    htmlStr += "<div><h3 align='center'>敌对：较高症状表现</h3></div>"
                }
                if (f < 1.09 && f > 0.41) {
                    htmlStr += "<div><h3 align='center'>敌对：较低症状表现</h3></div>"
                }
                if ((f > 1.77 && f < 2.45) || (f < 1.77 && f > 1.09)) {
                    htmlStr += "<div><h3 align='center'>敌对：中等水平症状表现</h3></div>"
                }
                if (g > 2.52) {
                    htmlStr += "<div><h3 align='center'>恐怖：高症状表现</h3></div>"
                }
                if (g < 0.4) {
                    htmlStr += "<div><h3 align='center'>恐怖：低症状表现</h3></div>"
                }
                if (g > 1.99 && g < 2.52) {
                    htmlStr += "<div><h3 align='center'>恐怖：较高症状表现</h3></div>"
                }
                if (g < 0.93 && g > 0.4) {
                    htmlStr += "<div><h3 align='center'>恐怖：较低症状表现</h3></div>"
                }
                if ((g > 1.46 && g < 1.99) || (g < 1.46 && g > 0.93)) {
                    htmlStr += "<div><h3 align='center'>恐怖：中等水平症状表现</h3></div>"
                }
                if (h > 3.23) {
                    htmlStr += "<div><h3 align='center'>偏执：高症状表现</h3></div>"
                }
                if (h < 0.47) {
                    htmlStr += "<div><h3 align='center'>偏执：低症状表现</h3></div>"
                }
                if (h > 2.54 && h < 3.23) {
                    htmlStr += "<div><h3 align='center'>偏执：较高症状表现</h3></div>"
                }
                if (h < 1.16 && h > 0.47) {
                    htmlStr += "<div><h3 align='center'>偏执：较低症状表现</h3></div>"
                }
                if ((h > 1.85 && h < 2.54) || (h < 1.85 && h > 1.16)) {
                    htmlStr += "<div><h3 align='center'>偏执：中等水平症状表现</h3></div>"
                }
                if (i > 2.71) {
                    htmlStr += "<div><h3 align='center'>精神病性：高症状表现</h3></div>"
                }
                if (i < 0.55) {
                    htmlStr += "<div><h3 align='center'>精神病性：低症状表现</h3></div>"
                }
                if (i > 2.17 && i < 2.71) {
                    htmlStr += "<div><h3 align='center'>精神病性：较高症状表现</h3></div>"
                }
                if (i < 1.09 && i > 0.55) {
                    htmlStr += "<div><h3 align='center'>精神病性：较低症状表现</h3></div>"
                }
                if ((i > 1.63 && i < 2.17) || (i < 1.63 && i > 1.09)) {
                    htmlStr += "<div><h3 align='center'>精神病性：中等水平症状表现</h3></div>"
                }
                if (j > 2.33) {
                    htmlStr += "<div><h3 align='center'>睡眠及饮食：高症状表现</h3></div>"
                }
                if (j < 0.57) {
                    htmlStr += "<div><h3 align='center'>睡眠及饮食：低症状表现</h3></div>"
                }
                if (j > 1.89 && j < 2.33) {
                    htmlStr += "<div><h3 align='center'>睡眠及饮食：较高症状表现</h3></div>"
                }
                if (j < 1.01 && j > 0.57) {
                    htmlStr += "<div><h3 align='center'>睡眠及饮食：较低症状表现</h3></div>"
                }
                if ((j > 1.45 && j < 1.89) || (j < 1.45 && j > 1.01)) {
                    htmlStr += "<div><h3 align='center'>睡眠及饮食：中等水平症状表现</h3></div>"
                }
                $("#explain").html(htmlStr);
            }
        })
    });
</script>

</html>


